







[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]
Finds the index of the maximum value in a list. A supplied Comparison<T> delegate is used
to compare the items in the collection.
Namespace: Wintellect.PowerCollections
Assembly:
PowerCollections (in PowerCollections.dll)
Syntax
C# |
---|
public static int IndexOfMaximum<T>( IList<T> list, Comparison<T> comparison ) |
Visual Basic (Declaration) |
---|
Public Shared Function IndexOfMaximum(Of T) ( _ list As IList(Of T), _ comparison As Comparison(Of T) _ ) As Integer |
Visual C++ |
---|
public: generic<typename T> static int IndexOfMaximum ( IList<T>^ list, Comparison<T>^ comparison ) |
Parameters
- list
- IList<(Of <T>)>
The list to search.
- comparison
- Comparison<(Of <T>)>
The comparison used to compare items in the collection.
Return Value
The index of the largest item in the list. If the maximum value appears multiple times, the index of the first appearance is used. If the list is empty, -1 is returned.
Type Parameters
- T
- The type of items in the list.
Exceptions
Exception | Condition |
---|---|
System..::ArgumentNullException | list or comparison is null. |
See Also
Algorithms Class
Wintellect.PowerCollections Namespace